Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command to check ocis backup consistency #9238

Merged
merged 14 commits into from
Jun 12, 2024

Conversation

kobergj
Copy link
Collaborator

@kobergj kobergj commented May 22, 2024

Adds consistency check command

Fixes #9004
E2E testing needs additional ticket: #9286

Copy link

update-docs bot commented May 22, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@kobergj
Copy link
Collaborator Author

kobergj commented May 23, 2024

Example output inconsistent case:

🚨 Inconsistent Nodes:
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/32/b1/37/f6/-f621-4a1d-9faf-244ab044c068
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/a0/28/b0/fa/-a5bb-453d-baea-1090df55faae
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/f2/86/2b/0b/-919d-4cd9-a35e-5e5a0b387587
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/a8/e5d981-41e4-4468-b532-258d5fb457d3/nodes/2d/08/8d/24/-96b5-478e-9602-425d1f084618
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/13/f6/fc/25/-0d6d-407b-9cbc-d4e4b8d46030
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/28/57/9b/25/-1ceb-46b8-b140-7ff536ef7b3d
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/a8/e5d981-41e4-4468-b532-258d5fb457d3/nodes/14/db/c9/b8/-6382-41f8-b2d7-5e0d7bbdbd98
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/58/35/d7/ba/-e8d0-40c1-ae84-6282058a9023
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/87/a6/12/3f/-f05a-4d20-913c-a0bda5784fae
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/c5/ed/4e/9d/-4bd1-4788-b65f-e238b48b5191
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/ca/ab/4e/5c/-6403-4909-bac1-edc702be27d9
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/d7/e9/ff/cf/-77d6-4d3e-a402-af3605aece6d
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/e1/54/2b/ea/-cfa3-4475-b848-25199d1a54a5
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/38/ae/a7/38/-375a-428a-a578-b52d10b10992
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/62/e0/eb/91/-91da-4466-81df-153a500e8c0b
        👉️ [symlink missing]    path: /home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/8f/71/a6/96/-7ffd-411c-8eba-dd99715b3860

🚨 Inconsistent Links:
        👉️ [node missing]       path: spaces/a8/e5d981-41e4-4468-b532-258d5fb457d3/nodes/a8/e5/d9/81/-41e4-4468-b532-258d5fb457d3/avatar(10)(12).png
                                missing node:/home/jkoberg/.ocis/storage/users/spaces/a8/e5d981-41e4-4468-b532-258d5fb457d3/nodes/a8/e5/d9/81/-41e4-4468-b532-258d5fb457d3
        👉️ [node missing]       path: spaces/a8/e5d981-41e4-4468-b532-258d5fb457d3/nodes/b9/66/72/90/-9baa-44ce-a321-82c2055dd772/readme.md
                                missing node:/home/jkoberg/.ocis/storage/users/spaces/a8/e5d981-41e4-4468-b532-258d5fb457d3/nodes/b9/66/72/90/-9baa-44ce-a321-82c2055dd772
        👉️ [node missing]       path: spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/be/d8/96/24/-5f34-4354-88c9-5935e13b81cd/burning_elmo.gif
                                missing node:/home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/be/d8/96/24/-5f34-4354-88c9-5935e13b81cd
        👉️ [node missing]       path: spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/fd/7e/15/95/-8946-4b6b-b78d-1fc715119386/oCIS activities-space history and eventlog.drawio(2).svg
                                missing node:/home/jkoberg/.ocis/storage/users/spaces/be/d89624-5f34-4354-88c9-5935e13b81cd/nodes/fd/7e/15/95/-8946-4b6b-b78d-1fc715119386

🚨 Inconsistent Blobs:
        👉️ [blob orphaned]      blob: /home/jkoberg/.ocis/storage/users/spaces/a8/e5d981-41e4-4468-b532-258d5fb457d3/blobs/8f/28/64/7f/-3e67-4b22-8574-a4fda80faa9c

🚨 Inconsistent BlobReferences:
        👉️ [blob missing]       blob: /home/jkoberg/.ocis/storage/users/spaces/a8/e5d981-41e4-4468-b532-258d5fb457d3/blobs/07/f9/4c/67/-b51d-4a9f-8a90-d896d26f46cc
                                referencing node:/home/jkoberg/.ocis/storage/users/spaces/a8/e5d981-41e4-4468-b532-258d5fb457d3/nodes/14/db/c9/b8/-6382-41f8-b2d7-5e0d7bbdbd98

Example output when clean:

💚 No inconsistency found. The backup seems to be valid.

@kobergj kobergj force-pushed the OcisConsistencyCheck branch 13 times, most recently from 8b149ec to ba0aad4 Compare May 29, 2024 09:29
@kobergj kobergj force-pushed the OcisConsistencyCheck branch 2 times, most recently from c7b0b74 to 84bf2b7 Compare May 31, 2024 08:39
@kobergj kobergj force-pushed the OcisConsistencyCheck branch 3 times, most recently from b918ae7 to 90868e2 Compare June 3, 2024 13:22
@mmattel
Copy link
Contributor

mmattel commented Jun 5, 2024

Some documentation is needed. Dont go the route without...
In owncloud.dev, create a subsection like Backup and add all backup related content underneath, starting with the existing Backup Considerations documentation. See the image how it currently looks:

image

kobergj and others added 6 commits June 6, 2024 15:55
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Co-authored-by: dragonchaser <crichter@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Co-authored-by: dragonchaser <crichter@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Co-authored-by: dragonchaser <crichter@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Co-authored-by: dragonchaser <crichter@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
kobergj and others added 6 commits June 6, 2024 15:55
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Co-authored-by: dragonchaser <crichter@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
docs/ocis/backup.md Outdated Show resolved Hide resolved
docs/ocis/backup.md Outdated Show resolved Hide resolved
docs/ocis/backup.md Outdated Show resolved Hide resolved
ocis backup consistency -p "<path-to-base-folder>"
```

`path-to-base-folder` needs to be replaced with the path to the storage providers base path. For example: "/var/lib/ocis/storage/users" or "$HOME/storage/users".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...the path to the storage providers base path. This sentence makes the path origin not clear, you should add the relevant envvar for reference so one can have a look how it was defined.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple envvars for it. Could be BASE_DATA_BASE or STORAGE_USERS_OCIS_ROOT or even STORAGE_SYSTEM_OCIS_ROOT. That is why put two examples instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say

STORAGE_USERS_OCIS_ROOT

The directory where the filesystem storage will store blobs and metadata. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/storage/users.

Referencing an envvar is imho much clearer as we have very good docs about...

docs/ocis/backup.md Outdated Show resolved Hide resolved
Co-authored-by: Martin <github@diemattels.at>
@kobergj kobergj marked this pull request as ready for review June 11, 2024 07:52
@wkloucek
Copy link
Contributor

wkloucek commented Jun 11, 2024

@kobergj I gave this tool a try today. I was executing it in a environment that is configured for the storage-users service only (storageusers pod in the oCIS Helm Chart). To be actually able to run this tool, I needed to configure following additional environment variables:

  • OCIS_JWT_SECRET
  • OCIS_MACHINE_AUTH_API_KEY
  • OCIS_SYSTEM_USER_ID
  • OCIS_SYSTEM_USER_API_KEY

Is there a reasoning why those secrets are needed for the backup check tool? From what I understand, the tool is concepted to be run against a file directory and blobstore without any running oCIS instance, so we probably don't need all those configuration options to be checked, right?

@wkloucek
Copy link
Contributor

wkloucek commented Jun 11, 2024

@kobergj how hard would it be to have a flag to skip blob related checks? We could use this for validating a NFS snapshot only (without connecting to the S3 at all)

EDIT: it also would kinda act as decomposed fs only consistency check.

@kobergj
Copy link
Collaborator Author

kobergj commented Jun 11, 2024

From what I understand, the tool is concepted to be run against a file directory and blobstore without any running oCIS instance, so we probably don't need all those configuration options to be checked, right?

Yes that is how it is concepted. I'll check what's wrong.

EDIT: Fixed. Needed to change a bool from true to false

@kobergj how hard would it be to have a flag to skip blob related checks? We could use this for validating a NFS snapshot only (without connecting to the S3 at all)

No problem. We can skip blob checking. I'll add a commandline parameter to do so 👍

EDIT: Implemented. Use -b none flag to avoid blob checking. (Neither orphaned nor missing blobs will be shown.)

@wkloucek implemented as suggested 👍

Signed-off-by: jkoberg <jkoberg@owncloud.com>
Copy link

sonarcloud bot commented Jun 11, 2024

Copy link
Contributor

@2403905 2403905 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for me

@kobergj
Copy link
Collaborator Author

kobergj commented Jun 12, 2024

Merging this. Will deliver additional features in subsequent PRs. Just ping me.

@kobergj kobergj merged commit adbc45e into owncloud:master Jun 12, 2024
4 checks passed
@kobergj kobergj deleted the OcisConsistencyCheck branch June 12, 2024 13:17
ownclouders pushed a commit that referenced this pull request Jun 12, 2024
Add command to check ocis backup consistency
@micbar micbar mentioned this pull request Jun 19, 2024
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ocis] Add S3NG consistency check
4 participants